var CryptoJS = require('./aes.js'); //引用AES源码js
var key = CryptoJS.enc.Utf8.parse("0123456789ABCDEF");
var iv = CryptoJS.enc.Utf8.parse('AES/ECB/PKCS5Padding');
//解密方法
function Decrypt(word) {
	var encryptedHexStr = CryptoJS.format.Hex.parse(word);
	var decrypt = CryptoJS.AES.decrypt(encryptedHexStr, key, {
		mode: CryptoJS.mode.ECB,
		padding: CryptoJS.pad.Pkcs7
	});
	return CryptoJS.enc.Utf8.stringify(decrypt);
}
//加密方法
function Encrypt(word) {
	var srcs = CryptoJS.enc.Utf8.parse(word);
	var encrypted = CryptoJS.AES.encrypt(srcs, key, {
		iv: iv,
		mode: CryptoJS.mode.ECB,
		padding: CryptoJS.pad.Pkcs7
	});
	return encrypted.ciphertext.toString().toUpperCase();
}

//暴露接口
module.exports.Decrypt = Decrypt;
module.exports.Encrypt = Encrypt;
